package demo.ht.com.basequickadpater.activitys;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;

import android.os.Bundle;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.RelativeSizeSpan;
import android.view.View;
import android.widget.TextView;

import java.util.ArrayList;

import demo.ht.com.basequickadpater.R;
import demo.ht.com.basequickadpater.utils.ItemRemoveRecyclerView;
import demo.ht.com.basequickadpater.utils.itemRemoveAdapter;

public class TouchEventActivity extends AppCompatActivity {
    Spannable ss1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_touch_event);
        ItemRemoveRecyclerView recycler_view = findViewById(R.id.recycler_view);
        TextView tv = findViewById(R.id.tv);

        recycler_view.setLayoutManager(new LinearLayoutManager(this));

        itemRemoveAdapter itemRemoveAdapter = new itemRemoveAdapter(this, getData());

        recycler_view.setAdapter(itemRemoveAdapter);


        SpannableString str = new SpannableString(Html.fromHtml(
                "2H<sup>+</sup> + So<sub size = 2>4</sub><sup size = 2>2-</sup> --> H<sub size =2>2</sub>So<sub size = 2>4</sub>"));
//        ss1.setSpan(new RelativeSizeSpan(0.6f), 2,3, 0); // set size
//        ss1.setSpan(new RelativeSizeSpan(0.6f), 8,11, 0); // set size
//        ss1.setSpan(new RelativeSizeSpan(0.6f), 17,18, 0); // set size
//        ss1.setSpan(new RelativeSizeSpan(0.6f), 20,21, 0); // set size
        tv.setText(str,TextView.BufferType.SPANNABLE);

    }

    private ArrayList<String> getData() {
        ArrayList<String> list = new ArrayList<>();

        for (int i = 0; i < 30; i++) {
            list.add(i+"");
        }
        return list;
    }
}